package cn.yunyichina.provider.hymed.util;

import okhttp3.*;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

/**
 * Created by Lullaby on 2017/10/20
 */
public class HttpUtil {

    public static String webservice(String content, String url) throws IOException {
        OkHttpClient client = new OkHttpClient().newBuilder().connectTimeout(10, TimeUnit.SECONDS).
                readTimeout(30,TimeUnit.SECONDS).build();
        RequestBody body = RequestBody.create(MediaType.parse("text/xml; charset=utf-8"), content);
        Request.Builder builder = new Request.Builder();
        builder.addHeader("SOAPAction", "");
        Request request = builder.url(url).post(body).build();
        Response response = client.newCall(request).execute();
        return response.body().string();
    }

}
